package top.misspro.valheimadminsocket.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

/**
 * @author liulinbo
 */
public class JSON {
    private static ObjectMapper mapper = new ObjectMapper();

    public static <T> T parserObject(String json, Class<T> tClass) throws IOException {
        return mapper.readValue(json, tClass);
    }

    public static String toJsonString(Object o) throws JsonProcessingException {
        return mapper.writeValueAsString(o);
    }
}
